package com.songcha.sakura.ui.adapter

import android.content.Context
import android.graphics.Color
import android.view.View
import android.widget.TextView


import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.songcha.library_common.ui.view.CustomContainerLayout_
import com.songcha.sakura.R
import com.songcha.sakura.bean.ComicListBean


class HomeScheduleWeekAdapter(val mContext: Context, list:MutableList<ComicListBean.ComicBean>) : BaseQuickAdapter<ComicListBean.ComicBean,BaseViewHolder>(R.layout.item_home_schedule_week,list) {


    override fun convert(holder: BaseViewHolder, item:ComicListBean.ComicBean) {

        val abp=holder.absoluteAdapterPosition
        holder.getView<TextView>(R.id.tv_title).apply {

            text=(abp+1).toString()+"."+item.title

            if(abp==0){
                setTextColor(Color.parseColor("#ff4a4a"))
            }else if(abp==1){
                setTextColor(Color.parseColor("#ff7701"))
            }else if(abp==2){
                setTextColor(Color.parseColor("#ffb400"))
            }else{
                setTextColor(Color.parseColor("#333333"))
            }

        }

        holder.getView<TextView>(R.id.tv_update).apply {
            setTextColor(Color.parseColor("#cccccc"))
            //val tvNew=holder.getView<TextView>(R.id.tv_new)
            val cclNew=holder.getView<CustomContainerLayout_>(R.id.ccl_new)
            if(item.update.contains("new")){
                text=item.update.substring(0,item.update.length-4)
                cclNew.visibility= View.VISIBLE
            }else{
                text=item.update
                cclNew.visibility= View.GONE
            }

        }


    }

}